//
//  QTTAddItemScrollView.m
//  QuTouTiao
//
//  Created by 杨杨子 on 2018/6/30.
//  Copyright © 2018年 杨杨子. All rights reserved.
//

#import "QTTAddItemScrollView.h"
#import "QTTPublicBtn.h"

@implementation QTTAddItemScrollView

-(instancetype)initWithFrame:(CGRect)frame AndArray:(NSMutableArray *)itemArray{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        CGFloat width = 60;//(SCREEN_WIDTH - self.height) / itemArray.count;
        
        for (NSInteger index = 0; index < itemArray.count; index ++) {
            QTTPublicBtn *button = [[QTTPublicBtn alloc] initWithFrame:CGRectMake(width * index, 0, width, self.height) andTittle:itemArray[index] AndTittleColor:[UIColor blackColor] AndTittleFont:16 AndBackColor:[UIColor clearColor] AndFatherView:self];
            [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
            button.tag = index;
        }
    }
    return self;
}
-(void)buttonAction:(UIButton *)sender{
    if (self.actionBringSthBlock) {
        self.actionBringSthBlock([NSString stringWithFormat:@"%ld",(long)sender.tag]);
    }
}
@end
